package pilgun.eshop.domain;

public class User {

    private long id;
    private String login;
    private String password;
    private String role;
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    public String getLogin() {
        return login;
    }
    public void setLogin(String login) {
        this.login = login;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    @Override
	public String toString() {
		return "User [login=" + login + "]";
	}
	public String getRole() {
        return role;
    }
    public void setRole(String role) {
        this.role = role;
    }
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((login == null) ? 0 : login.hashCode());
		result = prime * result
				+ ((password == null) ? 0 : password.hashCode());
		result = prime * result + ((role == null) ? 0 : role.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		User other = (User) obj;
		if (login == null) {
			if (other.login != null){
				return false;
			}
		}else{
			if (!login.equals(other.login)){
				return false;
			}
		}
		if (password == null) {
			if (other.password != null){
				return false;
			}
		}else{ 
			if (!password.equals(other.password)){
				return false;
			}
		}
		if (role == null) {
			if (other.role != null){
				return false;
			}
		}else{
			if (!role.equals(other.role)){
				return false;
			}
		}
		return true;
		
	}
    
    
}
